<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml" 
	  xmlns:h="http://java.sun.com/jsf/html" 
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:c="http://java.sun.com/jsp/jstl/core"
	  xmlns:p="http://primefaces.org/ui"
	  xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>

</h:head> 

<h:body>
	<ui:composition template="/template.xhtml">
		<ui:define name="conteudo">
			<center>
				<h:form>
					<p:growl id="messages" /> 
					<p:schedule value="#{eventoManagedBean.eventoModel}"
								allDaySlot="true"
								draggable="false"
								leftHeaderTemplate="today"
								rightHeaderTemplate="prev,next"
								centerTemplate="month, agendaWeek, agendaDay"
								style="display:inline-block; width:90%; ">
								
						<p:ajax event="eventSelect" listener="#{eventoManagedBean.onEventSelect}" 
								update="eventoDetalhes" oncomplete="eventoDialog.show()"/>
					</p:schedule>
								
					<p:dialog widgetVar="eventoDialog" showEffect="clip" hideEffect="clip" 
							  header="#{msg.evento}" styleClass="eventoDialog" width="600">

						<h:panelGrid id="eventoDetalhes" columns="2" cellspacing="5">
							
								
							<p:graphicImage height="150" width="300" rendered="#{eventoManagedBean.eventoSchedule.data.fotoEvento != null}" 
												value="#{eventoManagedBean.foto}"/>
							<h:panelGroup rendered="#{eventoManagedBean.eventoSchedule.data.fotoEvento != null}">
								<h:outputLabel value=""/>
							</h:panelGroup>
							
							<h:outputLabel value="#{msg.titulo}: " />
							<h:outputLabel value="#{eventoManagedBean.eventoSchedule.title}" />
							<h:outputLabel value="#{msg.dataInicio}: " />
							<h:outputLabel value="#{eventoManagedBean.eventoSchedule.startDate}" >
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</h:outputLabel>
							<h:outputLabel value="#{msg.dataTermino}: " />
							<h:outputLabel value="#{eventoManagedBean.eventoSchedule.endDate}" >
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</h:outputLabel>
							<h:outputLabel value="#{msg.conteudo}: " />
							<h:outputLabel value="#{eventoManagedBean.eventoSchedule.data.conteudo}" escape="false"/>
							<p:commandLink onclick="confirmacao.show();" rendered="#{eventoManagedBean.usuarioLogin.tipo == 1}">
								<f:setPropertyActionListener value="#{eventoManagedBean.eventoSchedule.data}" target="#{eventoManagedBean.evento}" />
								<h:graphicImage value="/img/excluir.png" title="#{msg.excluirEvento}" />
								<h:outputLabel value="#{msg.excluir}" />
							</p:commandLink>
							<h:commandLink action="#{eventoManagedBean.atualiza}" rendered="#{eventoManagedBean.usuarioLogin.tipo == 1}">
								<f:setPropertyActionListener value="#{eventoManagedBean.eventoSchedule.data}" target="#{eventoManagedBean.evento}" />
								<h:graphicImage value="/img/editar.png" title="#{msg.editarEvento}" />
								<h:outputLabel value="#{msg.editar}" />
							</h:commandLink>
						</h:panelGrid>
					</p:dialog>
					
					<p:confirmDialog id="confirmaExclusao" message="#{msg.perguntaExclusao} #{msg.este} #{msg.minEvento}?"
														 header="#{msg.excluirEvento}" severity="alert" widgetVar="confirmacao" closable="false">
						<p:commandButton id="confirma" value="#{msg.sim}" oncomplete="confirmacao.hide()" 
										 actionListener="#{eventoManagedBean.excluir}" update="@form"/>
						 <p:commandButton id="cancela" value="#{msg.nao}" onclick="confirmacao.hide()" 
										  type="button"/>	
					</p:confirmDialog>
			  	</h:form>
			</center>
		</ui:define>
</ui:composition>
</h:body> 
</html>